import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import htmlPlugin from 'vite-plugin-index-html';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue(), htmlPlugin({
        input: './src/main.ts',
        preserveEntrySignatures: 'exports-only',
    })],
    base: './',
    server: {
        port: 8080,
        proxy: {
            '/api': {
                target: 'http://127.0.0.1:80',
                ws: false,
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '/api')
            },
            '/defaultHub': {
                target: 'http://127.0.0.1:80',
                ws: true,
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/defaultHub/, '/defaultHub')
            }
        }
    },
    esbuild:{
        jsxFactory: 'h',
        jsxFragment: 'Fragment',
        jsxInject: "import { h, Fragment } from 'vue';"
    }
});
